/* 多头报表扩展方法 */

/* 自动横向扩展 */
function autoRight(gridId,minCol,minWidth){
	
	var minNum;	
	var width;
	
	if(minCol == undefined){
		minNum = 10;
	}else{
		minNum = minCol;
	}
	
	if(minWidth == undefined){
		width = window.screen.width;
	}else{
		width = minWidth;
	}

	var cellWidth = width / minNum;
	
	//列数获取
	var colNum = $("#"+gridId+" tbody tr:first td").length;
	
	if(colNum == 0){
		var rowNum = $("#"+gridId+" thead tr:first td").length;
		for(var i=0;i<rowNum;i++){
			var activeNum = $("#"+gridId+" thead tr:first td:eq("+i+")").attr("colspan");
			if(activeNum == undefined){
				colNum += 1;
			}else{
				colNum += Number($("#"+gridId+" thead tr:first td:eq("+i+")").attr("colspan"));
			}
		}
	}

		
//	alert(colNum);
	
	
	if(colNum > (minNum)){
		var minWidth = cellWidth * colNum;
		$("#"+gridId).css("width",minWidth+"px");
		$("#div_"+gridId).css("width",minWidth+"px");
	}
	
	
}